import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    sharedData: '',
    receivedData: 0,
  },
  mutations: {
    updateData(state, newData) {
      state.receivedData = newData;
    },
    updateReceivedData(state, length) {
      state.receivedData = length;
    },
    jian(state) {
      state.receivedData --
    }
  },
  actions: {
    setReceivedData({ commit }, receivedData) {
      commit('updateReceivedData', receivedData)
    }
  }
}); 